def index():
    with open("./template/index.html") as f:
        file_data = f.read()
    content = file_data.replace(f"{%content%}", "stock_data", 1)  # 替换1次
    return content
def center():
    with open("./template/center.html") as f:
        file_data = f.read()
    content = file_data.replace(f"{% content %}", "stock_data", 1)  # 替换1次
    return content
def error():
    return "404 error"

# 接口 解耦合
def application(req_path):
    if req_path == "/index.html":
        return index()
    elif req_path == "/center.html":
        return center()
    else:
        return error()